<!-- 所有游戏下注的统一模板 -->
<div class="main clearfix">
    <div class="content">
        <div class="sub-wrap clearfix">
            <div class="cont-main">
                <div id="subpage"><div class="cont-col3">
                    <div class="u-header play_tab_1 clearfix">
			            <div class="fl">
			        	    <span id="page_game_name">--</span>&nbsp;&nbsp;-&nbsp;&nbsp;<span id="page_name">--</span>
			        	    <span>&nbsp;&nbsp;当前彩种输赢：</span>
			        	    <span id="total_sum_money">0.00</span>
			            </div>
			            <div class="fr">
			        	    <span id="next_turn_num">--</span>&nbsp;期
			        	    距离封盘：<span id="bet-date">00:00</span>
			        	    距离开奖：<span id="open-date">00:00</span>
			            </div>  
			        </div>

                    <!-- 下注 -->
                    <div class="cont-col3-hd clearfix">
                        <div class="cont-col3-box2">
      	                    <span>金额 </span>
                            <input id="bet_money1" type="text" class="bet-money"> 
                            <a href="#" id="openBetWinBtn1" class="u-btn1 u-bet-ok">确定</a> 
                            <a href="#" class="u-btn1 u-bet-reset">重置</a> 
                        </div>
                    </div>

                    <!-- 具体的下注内容 -->
                    <div id="bet-detail-tab">
                    </div>

                    <!-- 下注 -->
                    <div class="cont-col3-hd clearfix" style="margin-top: 20px;">
                        <div class="cont-col3-box2">
      	                    <span>金额 </span>
                            <input id="bet_money2" type="text" class="bet-money"> 
                            <a href="#" id="openBetWinBtn2" class="u-btn1 u-bet-ok">确定</a> 
                            <a href="#" class="u-btn1 u-bet-reset">重置</a> 
                        </div>
                    </div>

                    <!-- 露珠 -->
                    <div id="luzhu-content" style="margin-top:20px; margin-bottom: 20px;">
                    </div>
                </div></div>

                <!-- 游戏统计 -->
                <div id="game_count"> 
                    <div class="count-wrap">
                    </div>
                </div>
            </div>

            <!-- 右边的长龙与快捷下注 -->
            <div id="right_page" class="cont-sider">
                <div class="sider-box1 mt5" id="stat_play_ctn">
                </div>

                <div id="kjtz-ctn" class="mt5 hide">
                    <table class="u-table2 play_tab_85">
                        <thead>
                            <tr>
                                <th colspan="3">快捷投注</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>

                <div class="sider-box1 mt5 hide" id="stat_play_ctn2">
                    <table class="u-table2">
                        <thead> 
                        <tr> 
                        <th id="stat_play_list_desc2">近期开奖结果</th> 
                        </tr> 
                        </thead> 
                    </table>
                    <table class="u-table5">
                        <tbody id="stat_play_list2"></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="js/counter.js"></script>
<script type="text/javascript">
    initCommon();
    window.game = window.game || urlInfo.params.game || 'bjpk10';
    switchGame(window.game);

    // 载入详细信息页
    function _loadGameBetPage() {
        $("#bet-detail-tab").empty();
        startLoading();
        $("#luzhu-content").empty();
        switch_page(urlInfo.params.game || "bjpk10", $("#bet-detail-tab"), function() {
            stopLoading();
            $(".checkbox_td").click(function(e) {
                var td = $(e.currentTarget);
                var input = td.find("input");
                if (e.target.nodeName == 'INPUT') return;
                if (input.attr("disable") == true) return;
                if (input[0].checked) input[0].checked = false;
                else input[0].checked = true;
                input.change();
            });

            if (window._afterGameLoaded) {
                window._afterGameLoaded();
                window._afterGameLoaded = undefined;
            }

            // 处理下封盘
            do_fengpan();
        });
    }

    // 填充tab标签
    function fillGameTabs(arr) {
        var div = $(".cate_menu");
        div.empty();
        for (var i = 0; i < arr.length; i++) {
            var l = '<a class="__c__" href="#" tid="__id__">__name__</a>';
            l = l.replace(/__c__/, i == 0 ? "selected" : "");
            l = l.replace(/__id__/, i + 1);
            l = l.replace(/__name__/, arr[i]);
            div.append(l);

            if (i != arr.length - 1) {
                div.append(' | ');
            }
        }

        var f = function(tid) {
            $("#page_name").html($(".cate_menu a.selected").html());
            for (var i = 1; i <= arr.length; i++) {
                if (tid == i) $("#tab" + i).show();
                else  $("#tab" + i).hide();
            }
        }

        $(".cate_menu a").click(function(e) {
            var resetF = function(target) {
                reset_counter();
                $(".cate_menu a").removeClass("selected");
                target.addClass("selected");
                var tid = target.attr("tid");
                f(tid);
                if ($("#tab" + tid).attr("flag") != 1) {
                    context.global.game[game].init(game, false);
                    refresh_bet_items();
                }
                do_fengpan();
                
                if (game == 'lhc') {
                    $("#kjtz-ctn").hide();
                    $(".kjtz_btn").html("快捷投注");
                }
                $("#stat_play_ctn").show();
            }

            var f2 = function() {
                resetF($(e.currentTarget));
            }
            if (window.notBetUI) {
                // 需要先载入投注页面
                var tid = $(e.currentTarget).attr("tid");
                window._afterGameLoaded = function() {
                    resetF($('.cate_menu a[tid="' + tid + '"]'));
                };
                switch_page("common", $(".content-wrap"));
            }
            else f2();
        });
        f(1);
    }
</script>